package answer

//#link: https://leetcode-cn.com/problems/coin-change-2/
func change(amount int, coins []int) int {
	//dp[i]表示填满金额为i的组合数量
	dp := make([]int, amount+1)
	dp[0] = 1
	//以可以使用的硬币为单位
	for _, coin := range coins {
		//用不同的硬币去凑总额
		for i := coin; i <= amount; i++ {
			dp[i] += dp[i-coin]
		}
	}
	return dp[amount]
}
